﻿//////////////////////////////////////////////////////////////////
//
// IAccount.cs
//
// Copyright (c) 2012 Dan Pike.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation files
// (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

namespace Interfaces
{
   /// <summary>
   /// Account-specific data
   /// </summary>
   public interface IAccount
   {
      ////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// A unique id for the current run. Created by the server and given to
      /// the client as part of the startup.
      /// </summary>
      string SessionId { get; set; }

      ////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// The user name for signing on to the network (RabbitMQ UserId)
      /// </summary>
      string UserName { get; }

      ////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// The password for signing on to the network (encrypted)
      /// </summary>
      string EncryptedPassword { get; }

      ////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// The TCP name of the server that we want to connect to
      /// </summary>
      string ServerName { get; }

      ////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Record the user name and password for this account, so that it can
      /// login when the network is connected
      /// </summary>
      /// <param name="userName"></param>
      /// <param name="encryptedPassword"></param>
      /// <param name="serverName"></param>
      /// <returns>true if the login succeeds</returns>
      bool Initialize(string userName, string encryptedPassword, string serverName);

      /// <summary>
      /// Try to logout
      /// </summary>
      /// <returns>true if was logged in</returns>
      void Shutdown();
   }
}
